/****************************************************************************
*  Title: design.sc
*  Author: Bryant Smith
*  Date: 04/16/2011
*  Description: Main behavior for parity generator / encoder
*               Accepts stream of input bytes and outputs encoded bytes
*               Input set even or odd parity 
****************************************************************************/

import "c_queue";
import "imageProcessor";
import "imageMatcher";

#define IMG_ROWS 480
#define IMG_CLMS 640

const unsigned long BIG_SIZE = 1000;

behavior stereoProcessor(i_receiver InQueueL, i_receiver InQueueR, out unsigned char
		imageLeft[IMG_ROWS][IMG_CLMS], out unsigned char imageRight[IMG_ROWS][IMG_CLMS],
		i_sender LaneOutQueue)
{
	leftImageProcessor  imgProcL(InQueueL, imageLeft, LaneOutQueue);
	rightImageProcessor imgProcR(InQueueR, imageRight);
	
	void main(void)
	{
		par
		{
			imgProcL.main();
			imgProcR.main();
		}
	}
};

behavior design(i_receiver InQueueL, i_receiver InQueueR, i_sender OutQueue,
		i_sender LaneOutQueue)
{
	// Design channls
	unsigned char imageLeft[IMG_ROWS][IMG_CLMS];
	unsigned char imageRight[IMG_ROWS][IMG_CLMS];
	
	stereoProcessor  imgStereo(InQueueL, InQueueR, imageLeft, imageRight, LaneOutQueue);
	imageMatcher     imgMatch(imageLeft, imageRight, OutQueue);

	void main (void)
	{
		while(1) 
		{
			imgStereo.main();
			imgMatch.main();
		}
	}
};
